package com.tang.h2_demo.service.impl;

import com.tang.h2_demo.dao.OperatorLogDao;
import com.tang.h2_demo.domain.OperatorLog;
import com.tang.h2_demo.service.OperatorLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author tangyuan2meicloud.com
 * @DATE 2021/12/23 20:48
 * @Desc
 * @Remarks
 */
@Service
public class OperatorLogServiceImpl implements OperatorLogService {
    @Autowired
    private OperatorLogDao operatorLogDao;

    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
    @Async
    @Override
    public void save(OperatorLog operatorLog) {
        operatorLogDao.save(operatorLog);
    }

    @Override
    public void delete(OperatorLog operatorLog) {
        operatorLogDao.delete(operatorLog);
    }

    @Override
    public List<OperatorLog> findAll() {
        return operatorLogDao.findAll();
    }
}
